// ------------------------------------------------------------
// Settings
// Slug: /ghost/settings/[many]
//
// Styles for the content management page, which is where
// the posts are listed.
//
// * Settings Navigation
// * Content
// * Headers
// * Custom Permalinks
// * Navigation
// ------------------------------------------------------------


//
// Settings Navigation
// --------------------------------------------------

.settings-nav {
    width: 25%;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 700;
    background: #fff;
    box-shadow: $lightbrown 1px 0 0;

    @media (max-width: 900px) {
        width: 100%;
        top: 0;
    }

    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        border-top: none;
        @media (max-width: 900px) {
            border-bottom: #edece4 1px solid;
        }
    }

    li {
        border-top: #fff 1px solid;
        position: relative;

        @media (max-width: 900px) {
            margin-right: 0;
            border-top: #edece4 1px solid;
        }

        // The icon
        &:before {
            position: absolute;
            top: 50%;
            left: 30px;
            transform: translateY(-50%);
            transition: color 0.1s;
            color: $brown;

            @media (max-width: 900px) {
                left: 15px;
            }
        }

        &:hover:before {
            color: $darkgrey;
        }

        a {
            display: block;
            border-bottom: $lightbrown 1px solid;
            padding: 15px 15px 15px 60px;
            border-bottom: none;
            color: $brown;

            @media (max-width: 900px) {
                padding-left: 45px;
                @include icon-after($i-chevron) {
                    float: right;
                    margin-top: 5px;
                }
            }

            &:hover,
            &:focus {
                color: $darkgrey;
                background: $lightbrown;
                text-decoration: none;
            }

            // Make space for icons
            &:before {
                margin-right: 20px;

                @media (max-width: 900px) {
                    margin-right: 15px;
                }
            }
        }//a

        &.active {
            @media (min-width: 900px) {
                margin-right: 0;
                position: relative;
                z-index: 300;
                border-top: #edece4 1px solid;
                box-shadow: #fff 1px 0 0, #edece4 0 1px 0;
                transition: all 0.15s ease-out 0s;

                // The icon
                &:before {
                    color: $darkgrey;
                }

                a {
                    color: $darkgrey;
                    font-weight: bold;
                    background: #fff;

                    &:focus {
                        background: $lightbrown;
                    }
                }
            }
        }//.active

        &:first-of-type {
            border-top: none;
        }
    }//li
}//.settings-nav

// Special cases for nav items
.settings-nav-labs .icon-labs:before {
    font-size: 16px;
}


//
// Content
// --------------------------------------------------
// The main content panel on the right

.settings-content {
    @media (max-width: 900px) {
        &.fade-in {
            animation: none;
        }
    }

    @media (min-width: 901px) {
        position: absolute;
        top: 0;
        right: 0;
        left: 25%;
        bottom: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .settings-general img {
        max-width: 100%;
        max-height: 400px;
        display: block;
    }

    .content {
        padding: 40px;

        @media (max-width: 550px) {
            padding-top: 15px;
        }

        @media (max-width: 900px) {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            padding-left: 15px;
            padding-right: 15px;
            overflow-x: hidden;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
    }//.content

    .word-count {
        float: right;
        font-weight: bold;
    }
}//.settings-content


//
// Headers
// --------------------------------------------------
// This is the header for /ghost/settings/view/
// On mobile, it's black and fixed position at the top of the screen

.settings-view-header,
.settings-subview-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    height: 44px;
    line-height: 44px;
    text-align: center;
    color: #fff;
    background: #242628;

    .btn-back {
        position: absolute;
        top: 4px;
        left: 4px;
        color: #fff;
        background: transparent;
    }

    .btn {
        vertical-align: top;
        line-height: 1.45;
    }

    .page-actions {
        position: absolute;
        top: 4px;
        right: 4px;
    }

    @media (min-width: 900px) {
        position: static;
        height: auto;
        padding: 30px 40px;
        line-height: 1.15em;
        background: none;

        .btn {
            vertical-align: middle;
            line-height: 1.428571429;
        }

        .page-title {
            display: inline;
            padding: 0;
            font-size: 2.6rem;
            line-height: 1.3;
            overflow: visible;
            color: $darkgrey;
        }

        .page-actions {
            position: static;
            float: right;
        }
    }//@media (min-width: 900px)
}//.settings-view-header, .settings-subview-header


.settings-view-header {
    @media (min-width: 900px) {
        text-align: left;

        .btn-back {
            display: none;
            vertical-align: middle;
            color: #666;
        }
    }
}

.settings-subview-header {
    @media (min-width: 900px) {
        .btn-back {
            position: static;
            float:left;
            color: #666;
        }
    }
}


//
// Custom Permalinks
// --------------------------------------------------

.permalink-input-wrapper {
    position: relative;
    outline: 0; // Kills the blue outline we get by adding tabindex="0"
    padding: 2px 0 2px 6px;

    &:focus,
    &.focus {
        border-color: $brown;

        // The button-looking thing that opens a popover
        .permalink-help {
            border-color: $brown;
        }
    }

    // A div that _looks_ like an input, but is a div
    .permalink-fake-input {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        margin-right: 40px;
    }

    .permalink-domain {
        margin: 5px -1px 3px 0;
        color: #7E878B;
    }

    .permalink-parameter {
        position: relative;
        padding: 3px 6px 4px;
        margin: 4px 0 4px 9px;
        max-height: 18px;

        // Change default label styles
        background: #E3EDF2;
        box-shadow: inset 0px 0px 0px 1px #CDD5D9;
        color: #7E878B;

        // The slash before each parameter (using :after)
        // Using `:before` does funky stuff here in Safari
        &:after {
            content: "/";
            position: absolute;
            top: 2px;
            left: -7px;
            font-size: 1.4rem;
            color: #7E878B;
        }
    }

    // The actual input, which resets some styles inherited from the global input style
    .permalink-input {
        flex: 1 0;
        margin: 0;
        padding: 0 4px;
        margin-right: -4px;
        background: transparent;
        min-width: 60px;
        border: 0;
    }

    // Shove the popover button and its container over to the right
    .popover,
    .permalink-help {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 36px;
    }

    // Simple styles for the popover button-looking thing
    .permalink-help {
        border-left: 1px solid #E0DFD7;
        transition: border-color 0.15s linear;

        &:before {
            color: #E0DFD7;
            transition: color 0.15s linear;
        }

        &:hover:before {
            color: $brown;
        }
    }

    // Shift the popover (than opens over the top of everything) to the left a bit
    .popover-item {
        margin-left: -5px;
        min-width: 320px;
    }
}//.permalink-input-wrapper


//
// Navigation
// --------------------------------------------------

.settings-navigation {}

.navigation-item {
    display: flex;

    @media (max-width: 600px) {
        margin-bottom: 20px;
    }
    @media (min-width: 601px) {
        margin-bottom: 10px;
    }
}

.navigation-item-drag-handle {
    padding-left: 10px;
    padding-right: 17px;
    width: 27px;
    cursor: move;
}

.navigation-inputs {
    width: 100%;
}

@media (max-width: 600px) {
    .navigation-item-label {
        margin-bottom: 5px;
    }

    .navigation-item-label,
    .navigation-item-url {
        display: block;
        width: 100%;
    }
}

@media (min-width: 601px) {
    .navigation-inputs {
        display: flex;
    }

    .navigation-item-label {
        flex-grow: 1;
        margin-right: 10px;
    }

    .navigation-item-url {
        flex-grow: 3;
    }
}

.navigation-item-action {
    padding-left: 10px;
    width: 40px;
    position: relative;

    button {
        width: 30px;
        height: 30px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        margin-top: -2px;
    }

    .icon-trash {
        &:before {
            color: $midbrown;
            font-size: 16px;
            transition: color 0.1s linear;
        }

        &:hover:before {
            color: $red;
        }
    }

    .icon-add {
        &:before {
            background: $green;
            color: #fff;
            font-size: 12px;
            padding: 3px;
            border-radius: 2px;
            transition: background 0.1s linear;
        }

        &:hover:before {
            background: darken($green, 10%);
        }
    }
}